home *** CD-ROM | disk | FTP | other *** search
- Conventions
- The following conventions are used throughout this
- document.
- 'Enter' means the Enter key or the Return
- key.
- Type 'key' means press the specified
- key without 'Enter'.
- Press F? means press the specified
- function key without 'Enter'.
- Enter means type in the specified
- text and followed by 'Enter' key.
- Select/Use an option:
- use cursor keys to move the
- highlighted option and press 'Enter', or
- type the upper-cased character on the left.
- GAF is not case sensitive, use either upper or
- lower cased key.
-
-
- Using The Menu
- The GAF system menu bar, at the top of the screen,
- is the primary user interface to the system. The
- system menu bar contains following menu items: File,
- Run, Display, Option, Adapt, Method, Segment, and
- Help. Use the first character of each menu item or
- use cursor keys (right/left arrows) to select the
- menu item. When a menu item is selected a pull down
- menu appears to provide function selection. To
- select a function item in a pull down menu either by
- the character on the left of that item or move the
- cursor with up/down arrow keys and then "Enter".
- When a function item is selected, further secondary
- menu selection or data entry dialog may be provided
- by that function. Except rule selection, all
- secondary menus and data entry dialog boxes are
- displayed immediately beneath the pull down menu.
- GAF uses rule text window for rule selection. Press
- ESC in pull down menu or secondary menu will return
- to system menu bar. Press ESC under system menu
- will bring up the Run pull down menu, except when
- the system menu was ESCaped from any of the running
- mode (i.e. from adapting or simulation). Please
- refer GAF.DOC for details. The following steps are
- typical for function selection under simulation or
- adapting.
- press "ESC" to escape back to system menu
- select desired function menu (see above)
- select desired function (see above)
- press "ESC" again under system menu to go back
-
- Introduction
- This simple example demonstrates the application of
- the fuzzy logic to control a motor based on its
- angular position feedback. Lets assume that this is
- a robot arm, and its arm extension limit (in angular
- position) is from 0 degree to 70 degree. The demo
- contains following segments:
- Control robotarm.gaf
- Feedbackrobotarm.dat
- Evaluation robotarm.evl
- Reference robotarm.ref
- The control segment uses a set of fuzzy rules to
- control the motor. The inputs to the control loop
- are angular position of the arm, position error, and
- angular speed of the arm. The output from the
- control segment is the current to the motor.
-
- The feedback segment uses a set of data to emulaste
- the reaction of the robot arm (the motor and its
- sensors). Outputs of the feedback loop are: the
- angular position and the angur speed of the robot
- arm. Note that there is a second example using
- fuzzy rules to emulate the feedback loop please
- refer to the file robotarm.fbk for details.
-
- The reference segment calculates the angular
- position error and generates a flag POS_REG for the
- above two segments. This flag is used to enable the
- segment or part of its logic. The reference segment
- can be scheduled in a lower rate if so desired.
-
- The evaluation segment evaluates the control loop
- for the application. Based on fuzzy rules it
- calculates the EVAL_RESULT output variable for the
- automatic adaptation.
-
-
- Simulation
-
- Run Simulation
- After start the demo, GAF displays the system
- menu at the top of the screen. Select run menu
- by typing 'R', then select "simulation mode" by
- either type 'S' or move high lighted cursor to
- "simulation mode" and press 'Enter'. After
- simulation mode is selected, GAF displays the
- control segment on the screen and waits for user
- input. Please refer to GAF.DOC for details of
- the display windows. Type 'F' to start the
- simulation. You should see the trend plots of
- inputs and outputs on the right and the rules and
- firing status on the left of the screen.
-
- Initialize the system
- Press function key F7 to initialize the system.
- The system reset is defined by the INITIALIZATION
- declaration in all segments of the system. Type
- 'F' again to run the simulation.
-
- View the feedback loop
- Now switch to the feedback loop by pressing F3,
- the screen displays the feedback segment. Press
- F7 to initialize the system, and then type 'F'.
- Now watch the plot of the inputs and the outputs
- for the feedback loop.
-
- Stepping through
- Let's switch back to the control loop by pressing
- F3 three times, and initialize it by F7. Now
- press 'Enter' to see the demo program goes one
- step. The program allows you to do one step by
- 'Enter' or multiple steps by typing 2 to 9, or 10
- steps by typing '0'. Type '0' and watch the
- program goes through 10 steps and note different
- rules are fired. At any time type 'F' will bring
- you to the end of the plot frame.
-
- Continuous mode
- Press 'C' to run the simulation continuously.
- You can stop continuous mode by pressing 'C'
- again or ESCape (press ESC) back to system menu.
- While in continuous mode press F7 to initialize
- the system.
-
- Change variable value
- Stop continuous mode by pressing 'C'. Now let's
- change the simulation from raising the arm to
- lowering the arm. Press F7 and then ESC to
- escape back to system menu. Press 'S' to select
- segment menu. The segment menu allows you to
- switch segment and change characteristics of the
- segment. Switch to feedback segment by selecting
- "segment number" under segment menu, or use F3 to
- switch. When using Segment menu to select a
- segment, GAF displays all segment names in a
- secondary menu and prompt for selection. Select
- segment menu again, and select "set input value".
- GAF pops all inputs in a menu beneath the segment
- menu, select "REFERENCE" input and enter its new
- value to 0. Select segment menu one more time to
- change the input variable "POSITION" value to 70
- (from "set input value"). Now get back to the
- simulation by pressing ESC, press F3 to switch
- back to control segment, and start simulation by
- stepping through it. Note that you can also
- change the "POSITION" value from the control
- segment (segment 0).
-
- View the plot
- From system menu type 'D' to select display menu.
- The display menu allows you to rearrange the
- display windows. Let's select "select plot only
- mode" by typing '5', and then escape back to
- simulation. GAF should redraw the screen with
- trend plot takes most of the screen. Run
- simulation by hiting F7 and then 'F'.
-
- View the combined result
- From Display menu select "select whole display
- mode". The right portion of the screen splits
- into two parts, the upper half shows the plot,
- and the lower half displays the combined result
- for the output. The combined result shows the
- trapezoid result of all fired rules (rules
- generate non-zero output). Rerun the simulation
- by pressing F7, and then 'F'. Now, the combined
- result tells you about the firing results of all
- rules and the defuzzified crisp output from all
- fired rules.
-
- View details about the fuzzy inference
- The above exercise only allows you to view the
- combined result of the output. GAF also allows
- you to examine the firing details of the rules.
- This feature along with the stepping mode is the
- best way to tuneup or debug the control system.
- From the segment menu, select "display rule
- firing", GAF highlights the first rule by using
- the left column of the text window. Use down
- arrow key to move to rule 5 and press 'Enter' to
- select it. Go back to the simulation, you'll
- find the selected rule's fuzzy sets are displayed
- to the left of the combined result. Note that
- each fuzzy set has the same color as the text
- window. Try previous exercises to view the
- changes of the fuzzy rule firing status.
-
- Disable rules
- GAF allows user to disable individual rule for
- testing fuzzy segment. Let's disable rule 10,
- this will effectively break the control system.
- Since there is no rule to respond when the
- POS_ERROR is VERY_LARGE, so after system reset
- (press F7) there will be no output from the
- control segment. From segment menu select
- "disable rule", GAF highlights the rule ID 0 on
- the left of the text window. Press 'End' to move
- the highlight cursor to rule 10, and then
- 'Enter'. Now restart the simulation by pressing
- ESC, F7 then 'F'. You should see the rule 10 is
- marked with 'X' to indicate it's been disabled,
- and also that there is no response to the
- position of the robot arm.
-
- Enable rules
- There are two options under segment menu allow
- you to enable rule(s). The "enable all rules"
- option enables all rules in this segment. The
- "enable rule" enables the selected rule. So,
- type 'A' under segment menu to enable rule 10.
-
- Change sampling rate
- Another important feature in GAF is that you can
- tune your system by trying different sampling
- rate (or cycle time defined in each segment).
- From Option menu select "sim schedule rate", GAF
- prompts for new rate. Enter 0.2 (in second) and
- restart the simulation. Please refer Schedule
- Policy section in GAF.DOC for details of
- different schduling mode.
-
- Increment/decrement sampling rate
- An easy way to change the simulated sampling rate
- is to use the '+' and '-' keys. Press '+' each
- time will cause the sample rate to increase 0.005
- second, and press '-' will decrease the sample
- rate by 0.005 second. The amount of
- increment/decrement (default is 0.005 second) can
- be changed through the Option menu's "Increment
- value" option. Now put the simulation in
- continuous mode by 'C', reset it by F7 and then
- use '+' and '-' keys to adjust the sample rate to
- find out what's the max stable rate of the
- control loop.
-
- Change output gain
- You can change the gain of the output, from
- segment menu's "set output gain" option. The
- default gain is 1.0.
-
- Check individual segment
- This feature allows you to examine one segment at
- a time. Let's examine the feedback loop's
- response at a constant motor current. Press F3
- once to switch to the feedback segment. From run
- menu select "check segment". Then from segment
- menu change the value of input variable "CURRENT"
- to 1.0. Run the simulation by typing 'F' to see
- the response of constant current input.
-
- Getting online help
- Press F1 to get online help.
-
- Display the system limits
- Press F2 to see the system limits.
-
- View segment information
- Press F4 to see the variable definition,
- initialization and normal functions, and other
- information for the selected display segment.
-
- View symbol definition
- Press F5 to see the fuzzy set symbols' definition
- for this segment.
-
- View preset definition
- Press F6 to view the preset definition for this
- segment.
-
- Set new plot time frame
- The default plot frame period is five seconds
- (except in sim clock mode), this can be changed
- through display menu's "plot duration" option.
-
- View local variables
- The default display mode is to display IN, OUT,
- and INOUT variables, the LOCAL variables are not
- displayed. Use "display local variable" option
- in display menu to enable/disable LOCAL
- variables.
-
- Quit the program
- Press 'Alt-Q' to quit the program under
- simulation or select "quit" option from run menu.
-
- Adapting the Fuzzy Segment
-
- The genetic adapt mode is an offline adaptation
- mode. While fuzzy logic mimics the human's
- imprecise reasoning, the genetic algorithm mimics
- the evolution of the nature. The genetic algorithm
- uses randomization techniques to reach optimum
- without exhausting searching through the solution
- state space. Apply genetic algorithm in fuzzy
- control eliminates problems associated with fuzzy
- system. GAF uses genetic algorithm to derive proper
- rules and fuzzy sets from the initial rules. By
- changing, adding, deleting rules and fuzzy
- membership sets of the fuzzy system, the genetic
- algorithm automatically adapts and optimizes the
- fuzzy control system.
-
- The adapting example is built on top of the
- simulation example, by adding an evaluation segment.
- The file "robotarm.evl" defines the evaluation
- segment.
-
- Start Adapting
- From system menu, type 'R' to bring up run menu.
- Select "adapt mode" by pressing 'A'. GAF starts
- adapting the control loop and displays the
- control segment along with adapt status on the
- top of the screen.
-
- Pause every iteration
- Press Alt-P to halt the adapting after each
- iteration. When an iteration is completed, GAF
- displays the status (Iteration done: ...) at the
- bottom of the screen and prompts for input.
- Press 'C' to continue next iteration. Press Alt-
- C to switch to continuous mode.
-
- Pause every cycle
- Press Alt-A to halt the adapting after each
- cycle. When a cycle is completed, GAF displays
- the status (Cycle done: ...) at the bottom of the
- screen and prompts for input. Press 'C' to
- continue next cycle. Press Alt-C to switch to
- continuous mode.
-
- Change size of gene pool
- Press 'Esc' while in continuous adapting, GAF
- brings up the system menu. Select adapt menu by
- type 'A'. From adapt menu select 'max best
- items', and enter a new pool size. This will
- change the number of genes will be saved by GAF.
-
- Change minimum score
- Again, from adapt menu, select "minimum score",
- GAF prompts for new minimum value. Enter 0.5,
- this tells GAF to accept all evaluation results
- ,which are greater or equal than 0.5. The
- default of the minimum score is 0.6.
-
- Change method weight
- The method menu provides user to control the
- algorithm of genetic adaptation. Select "adding
- rule" from method menu, enter 0 for its new
- weight. With zero weight, GAF will not generate
- (adding) new rule into the control loop.
-
- Print the result
- Select 'File' menu from the system menu, and type
- 'A' to generate report for all genes in the gene
- pool. The result will be saved in the
- adaptlog.rpt, as specified by "report file" under
- File menu, file of the current directory.
-
- Generate statistic report
- Again type 'S' (generate statistic log) from
- 'File' menu, GAF produces a statistic report file
- with the file name specified by 'statistic to' at
- the bottom of the menu. The log includes
- statistics for all methods. Based on the
- statistic you may want to adjust the weight of
- the methods.
-